﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using AgiliTrain.PhoneyTools;

namespace GooNews.Pages
{
  /// <summary>
  /// 
  /// </summary>
  public partial class AboutPage 
  {
    /// <summary>
    /// Initializes a new instance of the <see cref="AboutPage"/> class.
    /// </summary>
    public AboutPage()
    {
      InitializeComponent();
      versionBlock.Text = string.Concat("Version: ", App.Version);
    }

    /// <summary>
    /// Handles the Click event of the rateButton control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
    private void rateButton_Click(object sender, RoutedEventArgs e)
    {
      App.DoHaptic();
      new MarketplaceReviewTask().Show();
    }

    /// <summary>
    /// Handles the Click event of the sendEmail control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
    private void sendEmail_Click(object sender, RoutedEventArgs e)
    {
      App.DoHaptic();
      var task = new EmailComposeTask()
      {
         To = "shawn@agilitrain.com",
         Subject = "GooNews Feedback"
      };
      task.Show();
    }

    /// <summary>
    /// Handles the Click event of the crashButton control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
    private void crashButton_Click(object sender, RoutedEventArgs e)
    {
      App.DoHaptic();
      var task = new EmailComposeTask()
      {
        To = "shawn@agilitrain.com",
        Subject = "GooNews Crash Data",
        Body = string.Concat("Crash Log:", Environment.NewLine, Environment.NewLine, PhoneLogger.LogContents)
      };
      task.Show();
    }
  }
}